<template>
  <a-layout-header class="header">
    <div class="logo">
      <router-link to="/welcome" style="color: white; font-size: 16px">
        仲昊 12306管理控台
      </router-link>
    </div>
      <div style="float: right; color: white;">
        <router-link to="/login" style="color: white;">
          退出登录
        </router-link>
      </div>
    <a-menu
        v-model:selectedKeys="selectedKeys"
        theme="dark"
        mode="horizontal"
        :style="{ lineHeight: '64px' }"
    >
      <a-menu-item key="/welcome">
        <router-link to="/welcome">
          <coffee-outlined/> &nbsp;欢迎
        </router-link>
      </a-menu-item>

    </a-menu>
  </a-layout-header>
</template>

<script>
import {defineComponent, ref,watch} from 'vue';
import router from '@/router'
export default defineComponent({
  name: "the-header-view",
  setup() {
    const selectedKeys = ref([]);
    watch(() => router.currentRoute.value.path, (newValue) => {
      console.log('watch', newValue);
      selectedKeys.value = [];
      selectedKeys.value.push(newValue);
    }, {immediate: true});
    return {
      selectedKeys
    };
  },
});
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.logo {
  float: left;
margin-right: 24px;
  height: 31px;
  width: 150px;
  color: white;
  font-size: 20px;
}
.welcome-title{
  font-size:18px;
  color:white;
}
</style>
